/***
* ==++==
*
* Copyright (c) Microsoft Corporation.  All rights reserved.
*
* ==--==
* =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
*
* xxwinsock.h - Implementation Details of the winsock layer of messaging -- this header is safe for inclusion in
*               public APIs
*
* Functions and types for interoperating with Winsock from modern C++ 
*
* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
****/

#pragma once

#include <string>
#include "xxpublic.h"

namespace actors
{
namespace details
{
namespace winsock
{

/// <summary>
/// Gets the hostname of the local machine
/// </summary>
_ASYNCRTIMP std::string __cdecl get_hostname();

/// <summary>
/// Gets the hostname of the local machine
/// </summary>
_ASYNCRTIMP std::wstring __cdecl get_whostname();

/// <summary>
/// Initializes the Windows socket API.
/// </summary>
_ASYNCRTIMP int __cdecl socket_api_startup();

/// <summary>
/// Terminates and cleans up the Windows socket API.
/// </summary>
_ASYNCRTIMP int __cdecl socket_api_cleanup();

/// <summary>
/// Class to use RAII pattern for Windows socket API initialization.
/// </summary>
class scoped_socket_api
{
public:
    scoped_socket_api()
    {
        socket_api_startup();
    }
    ~scoped_socket_api()
    {
        socket_api_cleanup();
    }
};

}
}
}